using UnityEngine;
using UnityEngine.Video;

public class Log_Video : MonoBehaviour
{
	[SerializeField]
	private VideoPlayer targetVideoPlayer;

	[SerializeField]
	private AudioSource targetAudioSource;

	private void Update()
	{
		if (targetVideoPlayer.isPlaying && Mathf.Abs((float)(targetVideoPlayer.time - (double)targetAudioSource.time)) > 0.1f)
		{
			targetAudioSource.time = (float)targetVideoPlayer.time;
		}
	}

	private void Start()
	{
		if (targetVideoPlayer.audioOutputMode != VideoAudioOutputMode.AudioSource)
		{
			targetVideoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
			targetVideoPlayer.SetTargetAudioSource(0, targetAudioSource);
		}
		targetVideoPlayer.Play();
		targetAudioSource.Play();
	}
}
